package com.android.datn.activities.offline;

import com.android.datn.R;
import com.android.datn.R.layout;
import com.android.datn.R.menu;
import com.android.datn.activities.AAlbumItems;
import com.android.datn.activities.AHome;
import com.android.datn.activities.ANews;
import com.android.datn.activities.GActivityHome;
import com.android.datn.activities.GActivityNews;
import com.android.datn.activities.GActivityTop;
import com.android.datn.customs.view.SlideHolder;
import com.android.datn.helper.DBBinding;
import com.android.datn.objects.Album;
import com.android.datn.services.AudioPlayer;

import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

public class AOffline extends Activity implements OnClickListener {
	private Button mBtnAlbum, mBtnSong, mBtnArtist, mBtnDownload;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_offline);
		init();
	}

	public void init() {
		mBtnAlbum = (Button) findViewById(R.id.btn_album);
		mBtnArtist = (Button) findViewById(R.id.btn_artist);
		mBtnDownload = (Button) findViewById(R.id.btn_download);
		mBtnSong = (Button) findViewById(R.id.btn_song);
		mBtnAlbum.setOnClickListener(this);
		mBtnArtist.setOnClickListener(this);
		mBtnDownload.setOnClickListener(this);
		mBtnSong.setOnClickListener(this);
	}

	@SuppressWarnings("deprecation")
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btn_album:
			Intent t = new Intent(this, AAlbum.class);
			View view1 = GActivityOffline.group
					.getLocalActivityManager()
					.startActivity("Offline",
							t.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
					.getDecorView();
			GActivityOffline.group.replaceView(view1);
			break;
		case R.id.btn_song:
			Album album = new Album(-1);
			Intent t1 = new Intent(this, ASongOfAlbum.class);
			Bundle bundle = new Bundle();
			bundle.putSerializable(DBBinding.ALBUM, album);
			t1.putExtra(DBBinding.BUNDLEALBUM, bundle);
			View view = GActivityOffline.group
					.getLocalActivityManager()
					.startActivity("Offline",
							t1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
					.getDecorView();
			GActivityOffline.group.replaceView(view);
			break;
		case R.id.btn_artist:
			Intent t2 = new Intent(this, AArtist.class);
			View view2 = GActivityOffline.group
					.getLocalActivityManager()
					.startActivity("Offline",
							t2.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
					.getDecorView();
			GActivityOffline.group.replaceView(view2);
			break;
		case R.id.btn_download:

			break;

		default:
			break;
		}
	}

	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		GActivityOffline.group.back();
	}
}
